<?
	$nav = array("Home" => "", "Contact" => "contact/");

	$tpl->assign("dsfm_nav", $nav);

	$table = new Table( array(
		"id" => array(
			"width" => 20,
			"title" => "ID",
			"type" => "order",
		),
		"subject" => array(
			"width" => 150,
			"type" => "text",
			"link" => 'edit.php?id=$id'
		),
		"topic" => array(
			"width" => 200,
			"type" => "text",
			"link" => 'edit.php?id=$id'
		),
		"message" => array(
			"width" => 300,
			"type" => "text",
			"length" => 60,
		),
		"email" => array(
			"width" => 200,
			"type" => "text"
		),
		"add_date" => array(
			"width" => 150,
			"title" => "Add Date",
			"type" => "datetime",
		)
	));

	$sql = "SELECT * FROM contact_subject";
	$rss = $db->query($sql);

	$select = new Data($rss);
	$subject = $select->fetch_option("id","subject_th");

	$sql = "SELECT * FROM contact ORDER By id";
	$rss = $db->query($sql);

	$data = new Data($rss);

	$data->search();  // all field
	$data->search_text("search");

	$data->category("sid", $subject);
	$data->category_text("Select subject");

	$table->add_data($data->fetch());

	$table->add_tool( array(
		"edit" => array(
			"link" => 'edit.php?id=$id',
			"icon" => "edit.png"
		),

		"delete" => array(
			"link" => 'delete.php?id=$id',
			"icon" => "delete.png"
		)
	));

    $table->rain_display($tpl, "table"); 
?>